package com.itlong.cloud.enumerate;

import lombok.Getter;

/**
 * <desc>
 *      证书类型枚举
 * </desc>
 *
 * @createDate2020/9/27
 **/
public enum  LicenseTypeEnum {

    FORMAL_LICENSE(1,"正式证书"),
    ENGINEER_LICENSE(2,"工程调试证书");

    @Getter
    private Integer type;  //类型

    @Getter
    private String description;  //描述（名称）


    /**
     * <desc>
     *      构造函数.
     * </desc>
     *
     * @param type        类型
     * @param description 描述（名称）
     * @author Jiaqi.X
     * @createDate 2018/08/20
     */
    LicenseTypeEnum(Integer type, String description) {
        this.description = description;
        this.type = type;
    }

    /**
     * <desc>
     *      根据type获取description
     * </desc>
     *
     * @return
     * @Author Zhu.yj
     * @createDate  2020/9/27
     */
    public static String getDescriptionByType(Integer type){
        if (type != null){
            for (LicenseTypeEnum licenseTypeEnum : values()){
                if (type.equals(licenseTypeEnum.type)){
                    return licenseTypeEnum.description;
                }
            }
        }
        return "";
    }
}
